All Questions
Tagged with javascriptblock-editor
258 questions
2votes
0answers
81views
How can I check if a post is dirty using javascript on the edit post screen?
I'm trying to block a custom javascript function from running (with an appropriate error, of course) if the current post is dirty (ie, something has changed either in the editor or a custom field). I ...
0votes
1answer
29views
Wordpress custom post_status after 6.6 version
I'm trying to add custom post_status to WP after version 6.6 where status popup was introduced. Can someone tell me how to add own status to this popup? I wasn't able to find it. add_action('init', '...
1vote
1answer
22views
How do I hide block YouTube, Vimeo block variations from the Block inserter but keep already inserted blocks usable
I have tried all kinds of things. Nothing worked. Not sure if it's worth posting it all but. For example: add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_hide_blocks_script' ); ...
0votes
0answers
27views
Create a Query Loop block
I am creating a Query Loop block that retrieves post type, similar to Gutenberg's, but for various reasons I need to create one. Currently the code I am using is as follows and it works, but I would ...
0votes
0answers
12views
Modify Gutenberg blocks quick inserter defaults
I am trying to modify the blocks suggested via the quick inserter, ie the six blocks shown when you click the + button: The reason is that once we implement Gutenberg blocks on a certain website (...
2votes
1answer
61views
How to include block style variations for blocks in posts dynamically rendered via the Interactivity API
I'm building a block that shows an infinite list of posts using the Interactivity API: render.php <?php $block_attributes = get_block_wrapper_attributes() ?> <div <?php echo $...
0votes
1answer
67views
How to render initial posts on page load in a Gutenberg block using the Interactivity API?
I have the following code (view.js) for a Gutenberg block which uses the Interactivity API that renders posts when clicking a button: import { store, getContext, getElement } from '@wordpress/...
2votes
2answers
275views
How to render HTML content using the Interactivity API?
I'm testing the new Interactivity API and want build a block that renders the title and content of a random post. This is the content of the render.php file: <?php $block_attributes = ...
0votes
1answer
37views
How to get selected category objects in the block editor?
I am using the following functions to get the selected category objects. It seems to always return no matches even though there are several. What am I missing here? (function (wp) { const { ...
0votes
2answers
122views
How to auto rename JS files to prevent browser cache issues
Im creating a block plugin in worpress and each time I update my JS files, changes do not reflect to frontend because there's a browser cache. I found some strategies in others frameworks that rename ...
0votes
1answer
38views
How to use useSelect to retrieve the currently default fontFamily?
I'm trying to identify where I could find this information but I've not been able til the present moment, to achieve it. I've been looking in core/block-editor and core/editor. I've been researching ...
1vote
0answers
98views
Extend WordPress Gutenberg core/navigation-link
Hey folks So Im pretty new to this react + php in wordpress and I found one article where it showed how to extend a core block, which works fine for group and some basic block but When i tried to ...
1vote
1answer
595views
Add custom data attribute to every core Gutenberg Blocks
I'm adding two custom attributes to core Gutenberg blocks, data-delay and data-duration. I want to add these attributes to manage animations blocks on my custom theme. I wrote this JS code into block-...
2votes
0answers
52views
Block style variations not enqueued for blocks inside HTML code dynamically rendered via JS
The new WP 6.6 will let anyone style any registered block style variations in theme.json via the styles.blocks.blockName.variations property. Check the following post for more info: https://developer....
0votes
0answers
10views
Event when Modal is opened/visible
In my WordPress plugin, a Modal gets opened from within the Block Editor when a button is clicked. const MyContent = () => { const [isOpen, setOpen] = useState(false); const openModal = () =...